#include "stdio.h"
int main(void)
{
	int n,l = 0,i;
	int A[20];
	while((scanf("%d",&n) == 1) && n >= 0 && n < 55)
	{
		if(n == 0)
			break;
		A[l++] = n;
	}
	int s[60];
	s[0] = 1;
	s[1] = 2;
	s[2] = 3;
	for(i = 3;i<55;i++)
		s[i] = s[i-1]+s[i-3];
	for(i = 0;i<l;i++)
		printf("%d\n",s[A[i]-1]);
	return 0;
 }
